//
//  CSGXInventoryManagerMasterController.m
//  CarSalesMS_GCX
//
//  Created by Ssky on 2016/12/20.
//  Copyright © 2016年 Tony. All rights reserved.
//

#import "CSGXInventoryManagerMasterController.h"
#import "CSGXMasterCell.h"
#import "GXBaseTableView.h"
#import "CSGXMasterHeaderView.h"

static NSString *const inventoryMasterCellId = @"inventoryMasterCellId";
static NSString *const inventoryMasterHeaderId = @"inventoryMasterHeaderId";

@interface CSGXInventoryManagerMasterController () <UITableViewDelegate, UITableViewDataSource>

@end

@implementation CSGXInventoryManagerMasterController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}



#pragma mark - Actions



#pragma mark - methods
- (void)distribute {
    
}



#pragma mark - delegates

#pragma mark - tableView datasource and delegate

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
//    return self.inventoryMasterList.count;
    return 5;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    CSGXMasterCell *cell = [tableView dequeueReusableCellWithIdentifier:inventoryMasterCellId forIndexPath:indexPath];
    
    return cell;
}

- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
    CSGXMasterHeaderView *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:inventoryMasterHeaderId];
    header.titleList = @[@"行", @"产品名称", @"库存", @"仓库"];
    return header;
}
 




#pragma mark - setupUI
- (void)setupUI {
//    self.view.backgroundColor = [UIColor orangeColor];
    
    //
    GXBaseTableView *tvMaster = [[GXBaseTableView alloc] init];
    [self.view addSubview:tvMaster];
    
    [tvMaster mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.leading.bottom.trailing.equalTo(self.view).mas_offset(0);
    }];
//    tvMaster.backgroundColor = [UIColor orangeColor];
    tvMaster.tableFooterView = [[UIView alloc] init];
    tvMaster.delegate = self;
    tvMaster.dataSource = self;
    [tvMaster registerClass:[CSGXMasterCell class] forCellReuseIdentifier:inventoryMasterCellId];
    [tvMaster registerClass:[CSGXMasterHeaderView class] forHeaderFooterViewReuseIdentifier:inventoryMasterHeaderId];
    
    tvMaster.estimatedRowHeight = 80;
    tvMaster.rowHeight = UITableViewAutomaticDimension;
    
//    tvMaster.separatorStyle = UITableViewCellSeparatorStyleNone;
    
}



#pragma mark - setter & getter

//- (void)setInventoryMasterList:(NSArray *)inventoryMasterList {
//    _inventoryMasterList = inventoryMasterList;
//    
//    [self distribute];
//}




@end
